const { Schema, model } = require('mongoose');
const moment = require('moment');

const commentsSchema = new Schema({
    time: {
        type: String,
        default: moment().format('YYYY-MM-DD HH:mm')
    },
    content: String,
    foodsId: {
        type: Schema.Types.ObjectId,
        ref: 'foodsModel'
    },
    usersId: {
        type: Schema.Types.ObjectId,
        ref: 'usersModel'
    },
}, { versionKey: false });

const commentsModel = model('commentsModel', commentsSchema, 'comments');

module.exports.commentsModel = commentsModel;